<%#
# HasMany Form Partial

This partial renders an input element for has_many relationships.
By default, the input is a collection select box
that displays all possible records to associate with.
The collection select box supports multiple inputs,
and is augmented with [Selectize].

## Local variables:

- `f`:
  A Rails form generator, used to help create the appropriate input fields.
- `field`:
  An instance of [Administrate::Field::HasMany][1].
  Contains helper methods for displaying a collection select box.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
[Selectize]: http://brianreavis.github.io/selectize.js
%>

<div class="field-unit__label">
  <%= f.label field.attribute, for: "#{f.object_name}_#{field.attribute_key}" %>
</div>
<div class="field-unit__field">
  <%= f.select(field.attribute_key, nil, {}, multiple: true) do %>
    <%= options_for_select(field.associated_resource_options, field.selected_options) %>
  <% end %>
</div>
